/////////////////////////////////////////////////////////////////////////
//
// Amuse Engine SDK - system
// Copyright( c) 2013.  All Rights Reserved
//
// File:		AEEngineSystem.h
// Author:		Gianluca Belardelli
// Date:		04/04/2014
//
/////////////////////////////////////////////////////////////////////////
#ifndef _AEENGINESYSTEM_H_
#define _AEENGINESYSTEM_H_

class AEEngineSystem
{
// Members
protected:
	AEBOOL32 m_bInitialized;
	AEPropertyContainer *m_lpPropList;

public:
	static const AEUINT32 AENullSystem;
	static const AEUINT32 AEGenericSystem;
	static const AEUINT32 AEGeometrySystem;
	static const AEUINT32 AEGraphicsSystem;
	static const AEUINT32 AEPhysicsCollisionSystem;
	static const AEUINT32 AEAudioSystem;
	static const AEUINT32 AEInputSystem;
	static const AEUINT32 AEAISystem;
	static const AEUINT32 AEAnimationSystem;
	static const AEUINT32 AEScriptingSystem;
	static const AEUINT32 AEWaterSystem;
// Methods
public:
    /// \brief Costruttore di default.
    AEEngineSystem( void );

    /// <summary>
    ///   Gets the name of the system.  Only custom systems can return a custom name.
    ///   <para>
    ///	    Non-custom system must return a pre-defined name in Systems::Names that matches with the
    ////     type.
    ///	  </para>
    /// </summary>
    /// <returns>The name of the system.</returns>
    virtual char *GetName( void ) = 0;

    /// <summary>
    ///   Gets the system type for this system.
    /// </summary>
    /// <remarks>
    ///   This must function even w/o initialization.
    /// </remarks>
    /// <returns>The type of the system.</returns>
    virtual AEUINT32 GetSystemType( void ) = 0;

    /// <summary>
    ///   One time initialization function for the system.
    /// </summary>
    /// <param name="Properties">Property structure array to fill in.</param>
    /// <returns>An error code.</returns>
    virtual AEUINT32 Initialize( AEPropertyContainer *lpProperties ) = 0;

    /// <summary>
    ///   Gets the properties of this system.
    /// </summary>
    /// <remarks>
    ///   Implementation must work prior to initialization.
    /// </remarks>
    /// <param name="Properties">Property structure array to fill</param>
    AE_FORCEINLINE AEPropertyContainer *GetProperties( void ) { return m_lpPropList; }

    /// <summary>
    ///   Sets the properties for this system.
    /// </summary>
    /// <param name="Properties">Property structure array to get values from.</param>
    AE_FORCEINLINE void SetProperties( AEPropertyContainer *lpProperties ) { m_lpPropList = lpProperties; }

    /// <summary>
    ///   Creates a system scene for containing system objects.
    /// </summary>
    /// <returns>The newly create system scene.</returns>
    virtual AESystemSceneI *CreateScene( void ) = 0;

    /// <summary>
    ///   Destroys a system scene.
    /// </summary>
    /// <param name="pSystemScene">The scene to destroy. Any objects within are destroyed.</param>
    /// <returns>An error code.</returns>
    //
    virtual AEUINT32 DestroyScene( AESystemSceneI *lpSystemScene ) = 0;

    /// <summary cref="ISystem::GetCPUUsage">
    ///   Returns the CPU Utilization of FMOD
    /// </summary>
    /// <returns>CPU Utilization (0-100f)</returns>
	virtual AEFLOAT32 GetCPUUsage( void );

	static AE_FORCEINLINE AEUINT32 MakeCustomSystemID( AEUINT32 uiZeroBasedIndex );
	static AEUINT32 GetSystemIndex( AEUINT32 uiSystemType );
};

#endif // _AEENGINESYSTEM_H_
